<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<head>
<title></title>
<#include "top.html">
<link href="${base}/res/front/css/user.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
<!--
//2.是否是手机
function is_mobile(numstr)
{
	var reg = new RegExp("^1[0-9]{10}$");
	return reg.test(numstr);
}

function resetcode(){
	var i=parseInt(10*Math.random()); 
	var url='${base}/captcha.vsl?t='+new Date().getTime();
	$('#validatecode').attr('src',url);
	
}

//验证Email格式是否正确
function is_email(mail){
	var reg = /^([a-zA-Z0-9]+[_|\_|\.]?[-]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
    return reg.test(mail);
}

//3.验证状态
var validate = {
//		"mobile"	:false,
		"userName"	:false,
		"passWord"	:false,
		"rePassWord":false,
		"email"		:false
		//'imgcode'   :false
};

var rePost = '';
$(document).ready(function() {
//1.创建jQuery对象
//var $mobile 		= $("#txt_mobile");
//var $mobileMsg 		= $("#mobile_message");

var $userName 		= $("#txt_username");
var $userNameMsg 	= $("#username_message");

var $email 			= $("#txt_email");
var $emailMsg		= $("#email_message");

var $passWord		= $("#txt_password");
var $passWordMsg	= $("#pwd_message");

var $rePassWord		= $("#txt_repassword");
var $rePassWordMsg	= $("#repwd_message");

var $imgcode=$('#txt_verifycode');
var $imgcodeMessage=$('#imgcode_message');

var $submit			= $("#btn_submit");
var $register_code  = $("#txt_verifycode");

//4.验证方法
//验证手机
/*
var funValicateMobile = function(){

	var mobile = $mobile.val();
	if(mobile == "")
	{
		validate["mobile"] = false;
		//$mobileMsg.html("");
		$mobileMsg.html("<div class='n_i_m_e'>手机不能为空！</div>");
		return;
	}
	else
	{
		if(!is_mobile(mobile)){
			validate["mobile"] = false;
			setTimeout(function(){
				$mobileMsg.html("<div class='n_i_m_e'>手机格式不正确！</div>");
			},100);
		}else{
			$.post(site_root+"/index.php?con=user&act=register&ajax=1&dotype=mobile", {"val":mobile},
					function(dataobj){
						eval('var data='+dataobj);
						if(data.datastatus == 'success'){
							validate["mobile"] = true;
							$mobileMsg.html("<div class='n_i_m_r'>正确</div>");
						}else{
							message={'error':'手机格式不正确','haved':'手机已经存在'};
							showmessage=eval('message.'+data.message);
							validate["mobile"] = false;
							$mobileMsg.html('<div class="n_i_m_e">'+showmessage+'</div>');
						}
						funValidateSuccess();
					});
		}
	}
	funValidateSuccess();
};
*/

//验证会员名
var funValidateUserName = function()
{
	var userName = $userName.val();
	var nameLength = userName.replace(/[^\x00-\xff]/g, 'xx').length;

	if(userName == "")
	{
		validate["userName"] = false;
		$userNameMsg.html('<div class="n_i_m_e">用户名不能为空</div>');	
	}
	else
	{
		if(nameLength < 4 || nameLength > 15){
			validate["userName"] = false;
			$userNameMsg.html("<div class='n_i_m_i'>共" + nameLength + "个字符，要求4-15个字符，一个汉字为两个字符。</div>");
		}else{
			$.ajax({
			    type: 'post',
		        dataType: 'json',
		        data :{'userNickname':userName},
		        url: site_root+'/front/peraddnicknamecheck.htm',
		        cache : false,
		        success: function(data){
			       // eval('var data='+data);
					if(data.status == 'success') {
						validate["userName"] = true;
						$userNameMsg.html("<div class='n_i_m_r'>正确</div>");
					}else if(data.status == 'error'){
						message={'error':'用户名已经被注册'};
						//showmessage=eval('message.'+data.message);
						validate["userName"] = false;
						$userNameMsg.html('<div class="n_i_m_e">'+data.message+'</div>');
					}
					funValidateSuccess();
		        },
		        error: function(){
		            alert('服务器故障！');   
		        }
		        
		    });
		}
	}
	funValidateSuccess();
};

//验证密码
var funValidatePassWord = function()
{
	var passWord = $passWord.val();
	if(passWord == "")
	{
		validate["passWord"] = false;
		$passWordMsg.html("");
	}
	else
	{
		if(passWord.length < 6 || passWord.length > 16) {
			validate["passWord"] = false;
			$passWordMsg.html("<div class='n_i_m_i'>密码在6-16个字符内！</div>");
		}else{
			validate["passWord"] = true;
			$passWordMsg.html("<div class='n_i_m_r'>正确</div>");
		}
	}
	funValidateSuccess();
};

//验证确认密码
var funValidateRePassWord = function()
{
	if($rePassWord.val() == "")
	{
		validate["rePassWord"] = false;
		$rePassWordMsg.html("");
	}
	else
	{
		if($rePassWord.val() != $passWord.val()){
			validate["rePassWord"] = false;
			$rePassWordMsg.html("<div class='n_i_m_e'>两次密码输入不一致！</div>");
		}else{
			validate["rePassWord"] = true;
			$rePassWordMsg.html("<div class='n_i_m_r'>正确</div>");
		}
	}
	funValidateSuccess();
};

//验证电子邮箱
var funValidateEmail = function()
{ 
	var email = $email.val();
	if(email == "")
	{
		validate["email"] = false;
		$emailMsg.html("<div class='n_i_m_e'>邮箱不能为空！</div>");
	}
	else
	{
		if(!is_email(email)){
			validate["email"] = false;
			setTimeout(function(){
				$emailMsg.html("<div class='n_i_m_e'>邮箱格式不正确！</div>");
			},100);
		}else{
			$.post("${base}/front/peraddcheck.htm", {"mail":email},
			function(dataobj){
				eval('var data='+dataobj);
				if(data.status == 'success') {
					validate["email"] = true;
					$emailMsg.html("<div class='n_i_m_r'>正确</div>");
				}else{
					validate["email"] = false;
					$emailMsg.html('<div class="n_i_m_e">'+data.message+'</div>');
				}
				funValidateSuccess();
			});
			
		}
	}
	funValidateSuccess();
};



//判断是否全部通过验证
var funValidateSuccess = function(){
	for(var v in validate){
		if(!validate[v]){
			$submit.attr({'disabled':'disabled','class':'nosubmit'});		//禁止提交
			return false;
		}
	}
	$submit.removeAttr("disabled").attr('class','submit');		//允许提交
	return true;
};


funValidateSuccess();

	//绑定事件
//	$mobile.focus(function(){
//		if(validate["mobile"] == false){
//			$mobileMsg.html("<div class='n_i_m_i'>手机号码可用于登陆</div>");
//		}
//	}).blur(funValicateMobile);
	
	$userName.focus(function(){
		if(validate["userName"] == false){
			$userNameMsg.html("<div class='n_i_m_i'>4-15个字符，一个汉字为两个字符。</div>");
		}
	}).blur(funValidateUserName);
	
	$passWord.focus(function(){
		if(validate["passWord"] == false){
			$passWordMsg.html("<div class='n_i_m_i'>6-16个字符。</div>");
		}
	}).blur(funValidatePassWord);
	
	$rePassWord.focus(function(){
		if(validate["rePassWord"] == false){
			$rePassWordMsg.html("<div class='n_i_m_i'>请再输入一次密码。</div>");
		}
	}).blur(funValidateRePassWord).keyup(function(){
			if($rePassWord.val() == $passWord.val()){
				funValidateRePassWord();
			}
	});

	$email.focus(function(){
		if(validate["email"] == false){
			$emailMsg.html("<div class='n_i_m_i'>请输入您常用的邮箱。</div>");
		}
	}).blur(funValidateEmail);

	$("#txt_mobile,#txt_username,#txt_email,#txt_password,#txt_repassword").focus(function(){
		$(this).parent().addClass("bgHeighLight").removeClass("main");
	}).blur(function(){
		$(this).parent().addClass("main").removeClass("bgHeighLight");
	});
	
	//提交
/*	$("form").submit(function(){
		var success = funValidateSuccess();
		if(!success){
			return false;
		}
	});*/

    


	if(rePost == 'true'){
		//validate["mobile"] = true;
		validate["userName"] = true;
		validate["email"] = true;
		$mobileMsg.html("<div class='n_i_m_r'>正确</div>");
		$userNameMsg.html("<div class='n_i_m_r'>正确</div>");
		$emailMsg.html("<div class='n_i_m_r'>正确</div>");
		funValidateSuccess();
	}
	else
	{
		//$mobile.focus();
	}
});



//密码强度判断

function changePasswordStrong() {
    var level = checkPasswordStrong($("#txt_password").val());
    if (level == 0) {
        $("#password_level").get(0).className = "";
        $("#password_level_des").get(0).innerHTML = "太短";
    }

    if (level == 1) {
        $("#password_level").get(0).className = "pwdstr2";
        $("#password_level_des").get(0).innerHTML = "弱";
    }

    if (level == 2) {

        $("#password_level").get(0).className = "pwdstr3";
        $("#password_level_des").get(0).innerHTML = "一般";
    }

    if (level == 3) {
        $("#password_level").get(0).className = "pwdstr4";
        $("#password_level_des").get(0).innerHTML = "极佳";
    }

}

//密码强度判断
//0：太短 1：弱 2：一般 3：极佳
window.checkPasswordStrong = function (s) {
  var ls = 0;
  if (s.length < 6) {   //太短
      ls = 0;
  }
  else {
      if (/[a-z]/ig.test(s)) {//包含字母
          ls++;
      }
      if (/[0-9]/ig.test(s)) {//包含数字
          ls++;
      }
      if (/[^a-z0-9]/ig.test(s)) {//包含特殊字符
          ls++;
      }
  }
  return ls;
};

function register(){

var username = $("#txt_username").val();
var email = $("#txt_email").val();
var password = $("#txt_password").val();
var repwd = $("#txt_repassword").val();
var j_captcha = $('#txt_verifycode').val();

$.ajax({type: 'post',
		dataType: 'json',
		data :{'username':username,'email':email,'password':password,'repwd':repwd,'j_captcha':j_captcha},
		url: site_root+'/front/regset.htm',
		cache : false,
		success: function(data){
		if(data.status == 'success') {
			alert('注册成功');
			window.location.href=site_root+"/front/regok.htm";
		}else if(data.status == 'error'){
			alert(data.message);
		}},
		error: function(){
		   alert('服务器故障！');   
		}
	});
}

--></script>
<div class="wrap">
<div class="box">
<div class="content">
<div class="clearfix s_regbox">
<div class="s_regleft">
<input type="hidden" name="commit" value="1">
<input type="hidden" name="con" value="user">
<input type="hidden" name="act" value="register"/>
<div class="denglubox clearfix"><div class="denglu"></div><div id="servererror"></div></div>
<div class="denglubox clearfix" style=" padding:3px 3px 3px 10px; background-color:#dbffdc; width:500px; margin-left:40px;">
<img src="${base}/res/front/images/gantanhao.gif" style="vertical-align: middle;"> 请拍友珍惜自己的账号 且不要恶意注册多个账号 一旦违规 将予封号处理。</img>
</div>
<!--				
<div class="n_i_item clearfix">
<div class="n_i_item2">
<div class="n_i_name">手机号：</div>
<div class="n_i_input">
<div class="n_i_inputp"><input type="text" name="mobile" id="txt_mobile" value="" class="n_inputtext " /></div>
</div>
<div class="n_i_msg" id="mobile_message"><div class="n_i_m_i">1～20个字节之间(1汉字=2字节)</div></div>
</div>
</div>
-->
				
				<div class="n_i_item clearfix">
					<div class="n_i_item2">
						<div class="n_i_name">用户名：</div>
						<div class="n_i_input">
							<div class="n_i_inputp"><input type="text" name="username" value="" id="txt_username" class="n_inputtext "></div>
						</div>
						<div class="n_i_msg" id="username_message">
							<div class="n_i_m_i">当密码遗失时凭此找回</div>
						</div>
					</div>
				</div>
				<div class="n_i_item clearfix">
					<div class="n_i_item2">
						<div class="n_i_name">Email：</div>
						<div class="n_i_input">
							<div class="n_i_inputp">
								<input type="text" name="useremail" value="" id="txt_email" class="n_inputtext "></div>
						</div>
						<div class="n_i_msg" id="email_message">
							<div class="n_i_m_i">当密码遗失时凭此找回</div>							
						</div>
					</div>
				</div>
				<div class="n_i_item clearfix">
					<div class="n_i_item2">
						<div class="n_i_name">
							密&nbsp;&nbsp;&nbsp;码：</div>
						<div class="n_i_input">
							<div class="n_i_inputp">
								<input type="password"  name="userpassword" id="txt_password" class="n_inputtext" 
									onchange="changePasswordStrong();" onkeyup="changePasswordStrong();" />	
							</div>
						</div>
						<div class="n_i_msg" id="pwd_message">
							<div class="n_i_m_i">最少需要6个字符，字母区分大小写</div>
							
						</div>
					</div>
				</div>				
				<div class="n_i_item clearfix">
					<div class="n_i_item2">
						<div id="password_level" class="n_password_level" style="margin-left:90px;">
							<div class="n_passwordStrong">
								密码强度</div>
							<div class="n_thin">
								<div>
								</div>
							</div>
							<div class="n_thinword" id="password_level_des">
							</div>
						</div>
					</div>
				</div>
				<div class="n_i_item clearfix">
					<div class="n_i_item2">
						<div class="n_i_name">
							确认密码：</div>
						<div class="n_i_input">
							<div class="n_i_inputp">
								<input type="password" id="txt_repassword" name="txt_repassword" class="n_inputtext "></div>
						</div>
						<div class="n_i_msg" id="repwd_message">
							<div class="n_i_m_i">请再次输入密码</div>
							
						</div>
					</div>
				</div>
								<div class="n_i_item clearfix">
					<div class="n_i_item2" style="vertical-align: middle;">
						<div class="n_i_name">验证码：</div>
						<div class="n_i_input" style="vertical-align: middle;">
							<div class="n_i_inputp" style="vertical-align: middle;">
								<input type="text" id="txt_verifycode" maxlength="4" name="imgcode" class="n_inputtext " style="vertical-align: middle;width:100px;">
								<img  id="validatecode"  style="cursor: pointer;vertical-align: middle;"  title="更换验证码" src="/captcha.vsl" onclick="resetcode();"/>	
								</div>
						</div>
						<div class="n_i_msg" id="imgcode_message" style="vertical-align: middle;">
							<div class="n_i_m_i">请输入验证码</div>
							
						</div>
					</div>
				</div>
				<div class="n_i_item clearfix">
					<div class="n_i_item2">
						<div class="n_i_name">
						</div>
						<div class="n_i_input">
							<div class="n_i_inputp">
								<input type="submit" onclick = "register();" id="btn_submit" value="同意以下协议并注册" style="color:#870000;background:url('${base}/res/front/images/reg_btn1.png');width:140px;height:35px;border:0;cursor:pointer" />
								或<a href=""><img src="${base}/res/front/images/qqlogin.png" style="vertical-align:middle;" /> </a>只需10秒，免去注册流程。
							</div>
								
						</div>
					</div>
				</div>
				<div style="padding-top:0px;" class="n_i_item clearfix">
					<div class="n_i_item2">
						<div class="n_i_name">
						</div>
						<div class="n_i_input">
							<div class="n_i_inputp">
							点击查看《<a title="竞拍注册协议" target="_blank" class="red3" href="../con-article/act-help/id-69.html">乐拍客用户注册协议</a>》
						</div>
					</div>
				</div>
				</div>
				
			</div>
			<div class="s_regright">
				<div class="s_regtipbox">
				<div class="clearfix">
					<div class="s_regtip"><img src="${base}/res/front/images/regwarnbtn.png" alt="" /></div>
					 <div class="s_regtipspan">
					<span class="s_wrong"></span>若您已经拥有乐拍客账户，请勿再注册新账户，否则您的账号有可能将被锁定。
					<a target="_blank" title="竞拍注册指南" class="red3" href="../con-article/act-help/id-19.html">查看详情</a></div>
				</div>
				<div class="clearfix s_regtipmsg">
					<div class="s_regtip"><img src="${base}/res/front/images/regtipbtn.png" alt="" /></div>
					 <div class="s_regtipspan">
					<span class="s_tip"></span>乐拍客绝不泄露您的任何个人信息，免费注册即可获5粒体验豆。
					<a target="_blank" title="竞拍隐私条款" class="red3" href="../con-article/act-help/id-67.html">查看详情</a></div>
				</div>
			</div>
		</div>
		<div class="clear"></div>
		</div>
		<div class="clear"></div>
</div>
</div>
</div>
 <br/>
<div class="footer">
<div class="footerline">
<div class="clear"></div>
</div>
<div>

<div class="n_links">
<div style="color: #333">
官方客服工作时间安排(除法定节假日外，周一至周五 9：30-17：30,8小时不休息)</div>
<div style="line-height: 23px;">Copyright @2010-2012, <a href="../default.htm">乐拍客竞拍网</a> All
Rights Reserved. 
<a rel="nofollow"  href="../../www.miibeian.gov.cn/default.htm" target="_blank" title="乐拍客的备案号查询">京ICP备11042198
号</a>
</div>
<div class="icons">
<a rel="nofollow" title="" href="../../www.ectrustprc.org.cn/certificate.id/certificateb.php@id=20031864" class="bluelogo" rel="nofollow" target='blank'>
<img src="../views/leke/i/bluelogo.png" alt="" />
</a> 
<a rel="nofollow" title="" href="../../www.miibeian.gov.cn/default.htm" class="bluelogo" rel="nofollow" target='blank'>
<img src="../views/leke/i/validate.gif" alt="" />
</a> 
</div>
</div>
</div>
</div>
<div id="dialog" style="display: none;">
<img src="../views/leke/i/032.gif" alt="" />
</div>
<iframe	style="display: none;" src="" name='ajaxframe'></iframe>
<div style="z-index: 1000; background-color: rgb(0, 0, 0); visibility: visible; display: none; position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; width: 100%; filter: alpha(opacity = 50); opacity: 0.5; -moz-opacity: 0.5;" id="blurdiv">
</div>
<div class="p_toolTip" id="p_toolTip" style="display: none; position: absolute;">

<table cellspacing="0" cellpadding="0" border="0">
	<tbody>
		<tr>
		<td class="leftTop">&nbsp;</td>
		<td>
		<table cellspacing="0" cellpadding="0" border="0" class="arrowSet" style="width: 160px;">
<tbody>
<tr>
<td class="arrowTop">&nbsp;</td>
<td class="top" style="width: 100px; height: 20px;">&nbsp;</td>
</tr>
</tbody>
</table>
</td>
<td class="rightTop"></td>
</tr>
<tr>
<td class="left">&nbsp;</td>
<td class="tip">
<div class="content" id="tipcontent"
style="width: 150px; height: 40px;"></div>
</td>
<td class="right">&nbsp;</td>
</tr>
<tr>
<td class="leftBottom">&nbsp;</td>
<td>
<table cellspacing="0" cellpadding="0" border="0"
class="arrowSetBottom">
<tbody>
<tr>
<td class="bottom" style="width: 160px; height: 20px;">&nbsp;</td>
</tr>
</tbody>
</table>
</td>
<td class="rightBottom"></td>
</tr>
</tbody>
</table>


<div class="close" style="display: none;">&nbsp;<script type="text/javascript">
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F443f2e5081c8c65f25ce0fdbe5eb6d3e' type='text/javascript'%3E%3C/script%3E"));
</script></div>
</div>
<!-- Baidu Button BEGIN -->
<script type="text/javascript" id="bdshare_js" data="type=slide&amp;img=1" ></script>
<script type="text/javascript" id="bdshell_js"></script>
<script type="text/javascript">
	document.getElementById("bdshell_js").src = "../../bdimg.share.baidu.com/static/js/shell_v2.js@t=" + new Date().getHours();
</script>
<!-- Baidu Button END -->

</body>
</html>
